package application

import (
	log "github.com/sirupsen/logrus"
	"runtime"
	"usbipproxy/domain/service"
)

type ProgramService interface {
	Start() error
	Stop() error
}

var FactoryProgram = &ProgramServiceImplFactory{}

type ProgramServiceImplFactory struct{}

func (f *ProgramServiceImplFactory) Create(usbIpCmdSvc service.UsbIpServerCmdService) ProgramService {
	os := runtime.GOOS
	switch os {
	case "windows":
		log.Infof("当前是 Windows 系统")
		return NewProgramServiceWindowsImpl(usbIpCmdSvc)
	case "linux":
		log.Infof("当前是 Linux 系统")
		return NewProgramServiceLinuxImpl(usbIpCmdSvc)
	default:
		log.Infof("当前是其他系统：%s\n", os)
	}
	return nil
}
